﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Text;

using Tradex.ComponentModel;

namespace Tradex {

    /// <summary>
    /// The DataSeries class is the implementation of the IDataSeries interface.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class DataSeries<T> : IDataSeries<T> where T : new ()  {

        /// <summary>
        /// Public Constructor for the DataSeries, inintializing it with a specific
        /// size.
        /// </summary>
        /// <param name="numberEntries"></param>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
        public DataSeries(int numberEntries = 0) {
            //_Buffer = new PagedBuffer<T>(256, 8, 8);
        }

        //PagedBuffer<T> _Buffer;

        /// <summary>
        /// Gets or sets an element in the data series by index.
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public T this[int index] {
            get {
                return new T();
            }
            set {
            }
        }

        /// <summary>
        /// Adds a new default entry at the top DataSeries.
        /// </summary>
        public void AddEntry () {
            AddEntry(default(T));
        }

        /// <summary>
        /// Adds a new defiend value at the top of the DataSeries.
        /// </summary>
        /// <param name="entry"></param>
        public void AddEntry(T entry) {
        }

        /// <summary>
        /// Gets the count of items in the DataSeries.
        /// </summary>
        public int Count {
            get { return 0; }
        }

        /// <inheritdoc />
        public event NotifyCollectionChangedEventHandler CollectionChanged;

        void OnCollectionChanged (NotifyCollectionChangedEventArgs e) {
            if (CollectionChanged != null) {
                CollectionChanged(this, e);
            }
        }

    }
}
